import React, { Component } from 'react';
import { StyleSheet, View, Text, PixelRatio } from 'react-native';
import { GLOBAL } from '../../../../config/global';
import { style } from '../../../../theme/style';
import { orderStyle, commonStyle, commen } from '../_common/style';
import navigationSeevice from '../../../../components/navigation/navigationSeevice';
import moment from 'moment';
const scale = GLOBAL.SCALE;
export class SsCpt extends Component {
    constructor(props) {
        super(props);
        this.state = {

        }
    }


    render() {
        let { itemData, flagData } = this.props.data || {};
        let { orderType } = flagData || {};
        return (
            <View style={styles.tabBody}>
                {
                    itemData && itemData.length && itemData.map((item, index) => {
                        let time = orderType == 'S' ? item.outStockDate : item.signTime;
                        return (
                            <View style={ styles.tabLie } key={index}>
                                <View style={[orderStyle.listHead, commonStyle.row2]}>
                                    <Text style={orderStyle.listTitle}>{orderType == 'S' ? '发货' : '收货'}单 {item.sheetId || '-'}</Text>
                                    <Text style={orderStyle.listStatus}>{item.statusName || '-'}</Text>
                                </View>
                                <View style={commonStyle.row3}>
                                    <Text style={[orderStyle.listValue]}>{orderType == 'S' ? item.shippingTypeName : item.receivingTypeName || '-'}</Text>
                                    <Text style={[orderStyle.xian, { paddingTop: 5 * scale }]}>|</Text>
                                    <Text style={[orderStyle.listValue]}>{time && time.substring(0, 10)} {orderType == 'S' ? '发货' : '收货'}</Text>
                                </View>
                                <View style={commonStyle.row}>
                                    <View style={orderStyle.listRow}>
                                        <Text style={[orderStyle.listLable]}>{orderType == 'S' ? '发货' : '收货'}量(吨)</Text>
                                        <Text style={[orderStyle.listValue]}>{orderType == 'S' ? item.sendQuantity : item.signQuantity || '-'}</Text>
                                    </View>
                                    <View style={orderStyle.listRow}>
                                        <Text style={[orderStyle.listLable]}>结算量(吨)</Text>
                                        <Text style={[orderStyle.listValue]}>{item.settlementQuantity || '-'}</Text>
                                    </View>
                                    <View style={[orderStyle.listRow]}>
                                        <Text style={orderStyle.listLoad} onPress={() => { navigationSeevice.navigate('DefiniteDetailsPage', { sheetId: item.sheetId, orderType }) }}>[{orderType == 'S' ? '发货' : '收货'}明细]</Text>
                                    </View>
                                </View>
                            </View>
                        )
                    })
                }
            </View>
        )
    }
}

const styles = StyleSheet.create({
    tabLie: {
		paddingBottom: 15 * scale,
		marginTop: 15 * scale,
		borderBottomWidth: 1 / PixelRatio.get(),
		borderStyle: 'solid',
		borderBottomColor: '#E3E7F0',
	},
})